﻿REM 先写好当前时间戳
set "$=%temp%\Spring"
>%$% Echo WScript.Echo((new Date()).getTime())
for /f %%a in ('cscript -nologo -e:jscript %$%') do set timestamp=%%a
del /f /q %$%
set fileNameTimestamp=%timestamp%
:: 备份原有的配置文件
    :: 变量定义、赋值、字符串拼接赋值变量
    :: 将当前目录保存到参数nowBatDir(等号前后不要有空格）
    set nowBatDir=%~dp0
    :: 保存当前的盘符（之后要切换回来）
    set nowBatDird=%~d0
    :: 切换到C盘（防止在其他盘运行导致出错）
    C:
    ::cd "%userprofile%\.SpaceVim.d"
    cd "%userprofile%"

    :: ren  init.toml    init.toml_bak%date:~0,4%%date:~5,2%%date:~8,2%_%time:~0,2%%time:~3,2%%time:~6,2%
    :: ren  autoload   autoload_bak%date:~0,4%%date:~5,2%%date:~8,2%_%time:~0,2%%time:~3,2%%time:~6,2%

    ren  .SpaceVim.d    .SpaceVim.d_bak%fileNameTimestamp%

    :: 切换回原来的盘符
    %nowBatDird%
    cd  %nowBatDir%

    :: :: 建立软连接
    :: mklink /H "%userprofile%\.SpaceVim.d\init.toml"  "%nowBatDir%init.toml"
    :: mklink /j "%userprofile%\.SpaceVim.d\autoload"   "%nowBatDir%autoload"

    mklink /j "%userprofile%\.SpaceVim.d"   "%nowBatDir%"

:: 暂停
pause
